import { createRouter, createWebHashHistory } from 'vue-router'
import Home from '../views/Home.vue'
import homePage from '../views/home/index'
// homePage 随意起的名字
const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home,
    redirect: '/index',
    children:[
      ...homePage
    ]
  },
  {
    path: '/about',
    name: 'About',
    component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  },
  { // 路由的重定向，注意：一般写在，路由的最后面
    // 匹配所有路径  vue2使用*   vue3使用/:pathMatch(.*)*或/:pathMatch(.*)或/:catchAll(.*)
    path:'/:pathMatch(.*)',
    redirect: '/index'
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
